package com.woyou.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * 商品model
 * 
 * @author lenovo
 * 
 */
@SuppressWarnings("serial")
public class Goods extends SuperBean implements IChoose{
	
	/**
	 * 被选中的子商品列表
	 */
	private List<SubGoods> chosenSGList = new ArrayList<SubGoods>();
	
	/**
	 * 被选中的属性列表
	 */
	private List<Option> chosenOptList = new ArrayList<Option>();
	
	
	private int chosenNum;
	
	/**
	 * 菜品编号
	 */
	private String gId;
	
	/**
	 * 商品图片
	 */
	private String picUrl;
	
	/**
	 * 菜品名称
	 */
	private String gName;
	
	/**
	 * 单价
	 */
	private float price;
	
	/**
	 * 单位
	 */
	private String unit;
	
	/**
	 * 缺货标志 (1:正常, 2暂缺)
	 */
	private int state;
	
	/**
	 * 已被购买的份数
	 */
	private int saleNum;
	
	/**
	 * 促销图片url
	 */
	private String salesUrl;
	
	/**
	 * 详细商品图片Url
	 */
	private String detailPic;
	
	/**
	 * 固定套餐明细，有内容的产品一定有一个“明细”按钮可以点
	 */
	private List<String> detailList=new ArrayList<String>();
	
	/**
	 * 规格组，用于覆盖商品价格，可以为空，最多1个
	 */
	private OptionGroup specGroup;
	
	/**
	 * 多组M选N可选项，如果内含任何一项N>1，则该产品一定有一个“明细”按钮可以点
	 */
	private List<OptionGroup> optGList = new ArrayList<OptionGroup>();
	
	/**
	 * 可选子商品列表(Goods对象的子集,可复用Goods对象)
	 */
	private List<SubGoods> subGList = new ArrayList<SubGoods>();
	
	/**
	 * 子商品是否必须选择
	 */
	private boolean subGoodsRequired;
	
	/**
	 * 在商品列表中的角标
	 */
	private int position = -1;
	
	/**
	 * 新增一个Goods时要插入到显示列表中的角标号
	 */
	private int insertPos = -1;
	
	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}
	
	public int getInsertPos() {
		return insertPos;
	}

	public void setInsertPos(int insertPos) {
		this.insertPos = insertPos;
	}
	
	public String getgId() {
		return gId;
	}

	public void setgId(String gId) {
		this.gId = gId;
	}

	public String getPicUrl() {
		return picUrl;
	}

	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}

	public String getgName() {
		return gName;
	}

	public void setgName(String gName) {
		this.gName = gName;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public int getSaleNum() {
		return saleNum;
	}

	public void setSaleNum(int saleNum) {
		this.saleNum = saleNum;
	}

	public String getSalesUrl() {
		return salesUrl;
	}

	public void setSalesUrl(String salesUrl) {
		this.salesUrl = salesUrl;
	}

	public String getDetailPic() {
		return detailPic;
	}

	public void setDetailPic(String detailPic) {
		this.detailPic = detailPic;
	}

	public List<String> getDetailList() {
		return detailList;
	}

	public void setDetailList(List<String> detailList) {
		this.detailList = detailList;
	}

	public OptionGroup getSpecGroup() {
		return specGroup;
	}

	public void setSpecGroup(OptionGroup specGroup) {
		this.specGroup = specGroup;
	}

	public List<OptionGroup> getOptGList() {
		return optGList;
	}

	public void setOptGList(List<OptionGroup> optGList) {
		this.optGList = optGList;
	}

	public List<SubGoods> getSubGList() {
		return subGList;
	}

	public void setSubGList(List<SubGoods> subGList) {
		this.subGList = subGList;
	}

	public boolean isSubGoodsRequired() {
		return subGoodsRequired;
	}

	public void setSubGoodsRequired(boolean subGoodsRequired) {
		this.subGoodsRequired = subGoodsRequired;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((gId == null) ? 0 : gId.hashCode());
		result = prime * result + ((gName == null) ? 0 : gName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Goods other = (Goods) obj;
		if (gId == null) {
			if (other.gId != null)
				return false;
		} else if (!gId.equals(other.gId))
			return false;
		if (gName == null) {
			if (other.gName != null)
				return false;
		} else if (!gName.equals(other.gName))
			return false;
		return true;
	}

	@Override
	public List<Option> getChosenOptList() {
		return chosenOptList;
	}

	@Override
	public List<SubGoods> getChosenSGList() {
		return chosenSGList;
	}

	@Override
	public String getIds() {
		return gId;
	}

	@Override
	public void setIds(String ids) {
		
	}

	@Override
	public int getChosenNum() {
		return chosenNum;
	}

	@Override
	public void setChosenNum(int chosenNum) {
		this.chosenNum = chosenNum;
		
	}

	@Override
	public void setNames(String names) {
		this.gName = names;
		
	}

	@Override
	public String getNames() {
		return gName;
	}


	
	
}
